package com.app.designpattern.structural.flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * USER: zjw
 * DATA: 2019/4/17 0017
 * TIME: 上午 10:51
 */
public class EmployeeFactory {
    private static final Map<String, Employee> EMPLOYEE_MAP = new HashMap<>();

    public static Employee getManager(String department) {
        Employee employee = null;
        if (!EMPLOYEE_MAP.containsKey(department)) {
            employee = new Manager(department);
            ((Manager) employee).setReportContent("这是我报告");
            EMPLOYEE_MAP.put(department, employee);
        } else {
            employee = EMPLOYEE_MAP.get(department);
        }
        return employee;
    }
}
